package web_router

import (
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
	"io"
	"mime"
	"print-link/up/controller"
)

var r = gin.New()

func RouterInit() {
	gin.SetMode(gin.ReleaseMode)
	r.Use(gin.Recovery())
	gin.DefaultWriter = io.Discard
	crosConfig := cors.DefaultConfig()
	crosConfig.AllowAllOrigins = true
	// jeecgboot前端提交
	crosConfig.AddAllowHeaders("Authorization", "x-access-token")
	r.Use(cors.New(crosConfig))
	// Set a lower memory limit for multipart forms (default is 32 MiB)
	r.MaxMultipartMemory = 8 << 20 // 8 MiB
	mime.AddExtensionType(".js", "application/javascript")
	controller.WmsRoute(r)
	r.Run(":54321")
}
